Skip to content

use FormatMessageW for Windows system error messages#7609

Merged
waruqi merged 3 commits into
xmake-io:devfrom
choyy:win-errormessage
Jun 20, 2026
Merged

use FormatMessageW for Windows system error messages#7609
waruqi merged 3 commits into
xmake-io:devfrom
choyy:win-errormessage

Conversation

@choyy

@choyy choyy commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

改动前:

> xmake run
error: cannot execv(C:\Users\choyy\Downloads\hello\build\windows\x64\debug\hello.exe ), Unknown Error (740)

改动后:

> xmake run
error: cannot execv(C:\Users\choyy\Downloads\hello\build\windows\x64\debug\hello.exe ), 请求的操作需要提升。

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request improves Windows error reporting in core/src/xmake/os/strerror.c by using FormatMessageW to retrieve system error messages and converting them to UTF-8. The review feedback suggests refining this implementation by stripping trailing whitespace and newlines from the formatted message, ensuring proper null-termination during UTF-8 conversion, and adding a fallback mechanism if the conversion fails.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread core/src/xmake/os/strerror.c
@waruqi waruqi merged commit 6c3c436 into xmake-io:dev Jun 20, 2026
44 of 46 checks passed
@waruqi waruqi added this to the v3.1.0 milestone Jun 20, 2026
@choyy choyy deleted the win-errormessage branch June 23, 2026 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants